$(function () {
    let ve_logging = new Vue({
        el: "#login-box",
        data: {
            loginName: "",
            password: "",
            message: ""
        },
        methods: {
            login() {
                ajax_post("/auth/manager", {
                    loginName: ve_logging.loginName,
                    password: ve_logging.password
                }, function (response) {
                    if (response.code != null) {
                        ve_logging.message = response.message;
                    } else {
                        ve_logging.loginName = "";
                        ve_logging.password = "";
                        ve_logging.message = "";
                        window.location.href = "/manager_index";
                    }
                })
            }
        },
        computed: {
            no_empty_fields() {
                return this.loginName != "" && this.password != "";
            }
        }
    })
});